<template>
	<view>
		<u-navbar :title="$t('home.online_customer_service')" placeholder bgColor="#12be98" leftIconColor="#FFFFFF"
			titleStyle="color: #FFFFFF" autoBack>
		</u-navbar>

		<up-cell-group>
			<up-cell :title="linkUrl" @click="openLinkUrl(linkUrl)">
				<template #icon>
					<image class="link-icon" src="/static/image/link_icon.png" mode="" />
				</template>
			</up-cell>
		</up-cell-group>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		getSetting
	} from '@/api/index'

	const linkUrl = ref()
	const generalConfiguration = async () => {
		const res = await getSetting({
			codes: ['contact_customer_service_link']
		})

		linkUrl.value = res.data.setting.contact_customer_service_link
	}
	
	const openLinkUrl = (herf) => {
		// #ifdef APP-PLUS
		plus.runtime.openURL(herf);
		// #endif
		
		// #ifdef H5
		window.location.href = herf;
		// #endif
	}

	onLoad(() => {
		generalConfiguration()
	})
</script>

<style lang="scss" scoped>
	.link-icon {
		width: 88rpx;
		height: 88rpx;
	}
</style>